package method;
/*
setName
getName

 */
public class ThreadNameDemo1 {
    public static void main(String[] args) {
        MyThread mt1 = new MyThread("线程1");
        MyThread mt2 = new MyThread("线程2");
        //mt1.setName("线程1");
        //mt2.setName("线程2");
        mt1.start();
        mt2.start();
    }
}
class MyThread extends Thread {
    public MyThread() {
    }

    public MyThread(String name) {
        super(name);
    }
    @Override
    public void run() {
        for (int i = 0; i <200 ; i++) {
            System.out.println(super.getName()+" "+i);
        }
    }
}